package cn.monkey.family.data.uc.org;

import cn.monkey.family.data.EntityMapper;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.ReportingPolicy;

@Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE)
public abstract class OrganizationMapper extends EntityMapper<Organization, Organization, OrganizationVo> {
    @Override
    @Mapping(target = "creator", source = "creatorId", qualifiedByName = "getUserIdAndNamePairFromId")
    @Mapping(target = "updater", source = "updaterId", qualifiedByName = "getUserIdAndNamePairFromId")
    public abstract OrganizationVo toVo(Organization organization);

    @Override
    public abstract Organization toEntity(Organization organization);
}
